<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@include file="../commons/commons.jsp"%>
<!DOCTYPE html>

<head>
    <meta charset="utf-8" />
    <title>Data Tables</title>
</head>
<style>
	.info-title{color:#fff;font-size:14px;background-color:rgba(0,155,255,.8);line-height:26px;padding:0 0 0 6px;font-weight:lighter;letter-spacing:1px}
</style>
<body>
<form action="${ctx }/branchaddress/list.do" id="submit-form">
	<div class="page-body">
		<div class="row">
			<div class="col-xs-12 col-md-12">
				<div class="widget">
					<div class="widget-header ">
						<span class="widget-caption">地址管理</span>
					</div>
					<div class="widget-body">
                     <div class="table-toolbar">
						
						<div id="container" style="height:800px"></div>
						
					</div>
					</div>
				</div>
			</div>
		</div>
	</form>
</body>
<link rel="stylesheet" href="https://cache.amap.com/lbs/static/main1119.css"/>
<script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.0&key=052c13d08fc858c30b01709e835ebe5d"></script>
<script type="text/javascript" src="https://webapi.amap.com/demos/js/liteToolbar.js"></script>
<script>
	$(document).ready(function () {
	    $('#picUpload').bootstrapValidator();
	    getSubbranch();
	});
	var map =null;
   function getSubbranch(){
                // 高德地图返回经纬度
                var coord = null;
                 // 坐标经纬度
                coord = ['${branchAddress.longitude}','${branchAddress.latitude}'];
                // 地图
                  map = new AMap.Map('container',{
                        resizeEnable: true,
                        zoom: 15,
                        center: coord
                 });
                 var marker = new AMap.Marker({
                          position: coord
                 });
                 var infowindow = null;
                 marker.setMap(map);
                 marker.on('click',function(e){
                         infowindow.open(map,coord);
                 });
				AMap.plugin('AMap.AdvancedInfoWindow',function(){
                               infowindow = new AMap.AdvancedInfoWindow({
                                content: "<div class='info-title' style='width:400px'>${branchAddress.name}</div><div class='info-content'>地址：${branchAddress.address} <br/>联系方式：${branchAddress.phone}<br/></div>",
                                offset: new AMap.Pixel(0, -30)
                              });
                              infowindow.open(map,coord);
                            });
    };
</script>
</html>
